package com.googlecode.project.beans;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

public class UserBean {

	private String userName = null;
	private String password = null;

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String loginUser() {
		if (getUserName().equals("sean") && getPassword().equals("sean"))
			return "success";

		FacesContext facesContext = FacesContext.getCurrentInstance();
		FacesMessage facesMessage = new FacesMessage("You have entered an "
				+ "invalid user name and/or password");
		facesContext.addMessage("loginForm", facesMessage);

		return "failure";
	}
}
